package com.obst.story.application.fragment;

import java.util.ArrayList;

import com.obst.story.R;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ArrayAdapter;
import android.widget.ListView;

@SuppressLint("SetJavaScriptEnabled")
public class MainTaskFragment extends Fragment{
	private View mContentView;
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
		mContentView = inflater.inflate(R.layout.maintaskfragment, null);
		
		return mContentView;
		/*
		ArrayList<String> strList = new ArrayList<String>();
		strList.add("text1");
		strList.add("text2");
		strList.add("text1");
		strList.add("text2");
		
		ArrayAdapter<String> Adapter;
		
		View view = inflater.inflate(R.layout.maintaskfragment, container, false);
		Adapter = new ArrayAdapter<String>(view.getContext(), android.R.layout.simple_list_item_1, strList);
		ListView list = (ListView) view.findViewById(R.id.maintasklist);
		list.setAdapter(Adapter);
		
		
		return view;
		*/
	}
    
	@Override
    public void onActivityCreated(Bundle savedInstanceState)
    {
        super.onActivityCreated(savedInstanceState);
        
        WebView webview = (WebView)mContentView.findViewById(R.id.webview);

        webview.getSettings().setJavaScriptEnabled(true);
        webview.loadUrl("file:///android_asset/mainTaskList.html");
        webview.setWebViewClient(new WebViewClientClass());
    }
	private class WebViewClientClass extends WebViewClient {
		
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			view.loadUrl(url);
			return true;
		}
			
	}
}


